import time

from selenium import webdriver
from selenium.webdriver.common.by import By
d = webdriver.Chrome()
d.maximize_window()
d.get('https://www.baidu.com')
# 获取标题
print(d.title)
# 获取当前窗口的网址
print(d.current_url)
# 获取属性对应的值 get_attribute('属性名称')获取该属性对应的值
button = d.find_element(By.CSS_SELECTOR,'[id="su"]')
res = button.get_attribute('id')
print(res)
# 获取文本信息 .text获取该元素的文本信息
link = d.find_element(By.CSS_SELECTOR,'[class="title-content-title"]')
ss = link.text
print(ss)

d.quit()